<?php

class OwnerSpecificData extends CActiveRecord
{
	/**
	 * The followings are the available columns in table 'project':
	 * @var integer $id
	 * @var string $field_name
	 * @var string $field_value
	 */

	/**
	 * Returns the static model of the specified AR class.
	 * @return CActiveRecord the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'owner_spec';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		return array(
			array('field_name','length','max'=>8),
			array('field_value','length','max'=>8),
			array('field_name', 'required'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'owner' => array(self::BELONGS_TO, 'Owner', 'owner_id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'owner_id' => 'Owner Id',
			'field_name' => 'Field name',
			'field_value' => 'Field Value',
		);
	}
	
	public function primaryKey() {
		return array('owner_id', 'field_name');
	}
}